package org.NooLab.itexx.app.gui.handlers.keys;

import org.NooLab.itexx.ITexxWindowCommons;
import org.NooLab.itexx.app.controller.ItexxModelController;
import org.NooLab.itexx.app.gui.handlers.WindowAppearanceIntf;
import org.NooLab.itexx.browser.KeyCodes;




public class GuiWorkerRelais implements KeyActionIntf {

	WindowAppearanceIntf windowAppearance;
	private ItexxModelController modelController;
	private ITexxWindowCommons appCommons;
	
	
	
	public GuiWorkerRelais(WindowAppearanceIntf windowAppearance, int param) {
		// 
		this.windowAppearance = windowAppearance;
		
		modelController = windowAppearance.getWindowGui().getItexxModel();
		appCommons = modelController.getTexxWindowApp().getAppCommons() ;  
	}

	@Override
	public void perform(int parameter) {
		// 
		
		if (parameter==11){ // clear list
		
			windowAppearance.clearResultList(parameter);
		}
		if (parameter==999){
			windowAppearance.exitApplication();
		}
		
		if (parameter==40){
			windowAppearance.getWindowGui().toggleStatusBar();
		}
		
		// these need to be managed through the model controller
		if (parameter==32){
			// remove the selected panel (note, that the content will be removed, and all contents moved one up 
			 // 
			modelController.removePanel(modelController.getLastClickedPhysicalPanel(),0);
			return;
		}
		if (parameter==11){
			// clearing all panels
			windowAppearance.getWindowGui().getItexxModel().clearPanelList(0);
			return;
		}



	}

}
